package com.carter.springframework.aop;

import com.carter.springframework.util.ClassUtils;

/**
 * 被代理的目标对象
 */
public class TargetSource {
    private final Object target;

    public TargetSource(Object target) {
        this.target = target;
    }

    public Class<?>[] getTargetClass(){
        Class<?> clazz = target.getClass();
        clazz = ClassUtils.isClibProxyClass(clazz)?clazz.getSuperclass():clazz;
        return clazz.getInterfaces();
    }

    public Object getTarget() {
        return target;
    }
}
